package com.baidu.springcloud.controller;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

import javax.annotation.Resource;

/**
 * @author ShiLei
 * @version v1.0
 * @date 2020-03-24 17:33
 */
@RestController
public class ConsumerNacosController {

    @Resource
    private RestTemplate restTemplate;

    @Value("${service-url.nacos-user-service}")
    private String serverURL;

    @GetMapping("consumer/payment/nacos/{id}")
    public String consumerInfo(@PathVariable String id) {

        return restTemplate.getForObject(serverURL + "/payment/nacos/" + id, String.class);
    }
}
